Support launching Multi-Release-Compiled Projects#753
Support launching Multi-Release-Compiled Projects#753stephan-herrmann merged 1 commit intoeclipse-jdt:masterfrom
Conversation
|
This looks promising. Also here I would like to see a few junit tests. As we would need to assert the effect of a launched program, likely by way of its console output, perhaps org.eclipse.jdt.debug.tests.core.ConsoleTests.testConsoleOutputSynchronization() is the closest example to start from (but then to be placed into the package o.e.j.debug.tests.launching, I suppose). FYI, while playing with this feature I created MRTest.zip including 3 launch configurations that produce different results. Interestingly, for me To prevent surprised and unhappy users I could see two options:
|
This is exactly how it is supposed to work. An execution environment is only an abstraction to select a physical VM but does not has any meaning on runtime, so the behavior is correct and wanted. The exactly same would happen if the launch contains a already packaged MR-jar and there is nothing one can do to influence that behavior. |
I read this as a vote for my second option
Motivation: when a user selects a specific EE for launching a multi-release program, they likely want to test how it works on that particular version (unless, perhaps, the EE matches the project's default release version). I won't insist on this being an error, but some alert should be given. From your comment I could also guess that such a launch should preferably select a physical JRE rather than an EE? I see that you are well aware of this issue, but we should also do our best for other users to learn these fine points with minimal pain :) |
My vote would be to do nothing in this area (at least not at this stage). If I where to develop and test such feature I would expect that I always use a specific JVM and not an EE. But of course I would not say it is forbidden and can be used if configured correctly. As when I run a program it shows me the actually used physical JVM I also don't see a high risk of confusion because one always can see what one gets. Second, one might argue that such a warning is required for any MR jar on the classpath of any launch then because this could have the same surprising effect of course then as well. I'm just not sure such extra errors/warnings dialog pay of the efforts. So given we have all these technical issues solved and then there is a high demand from users because they constantly fail to understand the issue, then it might be considered to add something, but then it has to be done on a broader scope, especially as since modular JVMs have become mainstream the concept of EE has become a bit obsolete anyways. |
|
@stephan-herrmann I now added a test-case for this based on your example. |
I moved this topic to #756 (as mentioned, I don't expect every user to be sharply aware of these fine points). |
stephan-herrmann
left a comment
There was a problem hiding this comment.
The test issue "Illegal Thread access" must be resolved.
I also dropped some lesser comments.
Testing this locally, I came across an "infrastructure problem": Initially, tests did not find all required JREs, and as a result it ran all variants using the same JRE (in my case: 24) and failed.
So this test introduces a requirement, that JREs 11, 17 and 21 are installed in a way that can be discovered by DetectVMInstallationsJob.
On my machines I installed tons of JDKs in a non-standard, user-owned location.
Only be inspecting the code in DetectVMInstallationsJob I found a way to make my installations known for the benefit of this test: link the location of JDK installs into ~/.sdkman/candidates/java.
I wonder if this will cause headaches for other jdt.debug developers?
At the very least this requirement should be documented in the new test.
@iloveeclipse @subyssurendran666 @SougandhS anyone care to comment?
Or do you mean something else? |
Here it is not about disabling DetectVMInstallationsJob, but about ensuring that it finds the exact version 11, 17 and 21 on developer machines where those exact versions may or may not exist in the standard location (linux: /usr/lib/jvm/*). |
Still not sure what you mean. Both mentioned locations are already on the search path. Do you mean, you would like to filter found JVM's additionally by some extra flag? |
Let my try again :) When I first ran the new test on my local machine it failed. Failed not because any code is "wrong", but because DetectVMInstallationsJob makes assumptions that are not met on my local machine: it expects to find (most) VMs inside I have found a solution that works for me personally, but the question is: will current or future devs of jdt.debug run into trouble should they need to run tests locally? Hence my proposal: let's add smth like the following as a comment in the new test:
And the question: is this enough to avoid unnecessary churn for jdt.debug devs? |
Why not add assertion with appropriate fail message at the beginning of the test? |
Sounds good to me. Can you add this, @laeubi ? And then the above hints (about |
Let me predict that such new assertion will fail on jenkins and thus explain the current failure:
Perhaps jenkins no longer offers JDK 11? |
Autodiscovery of JVMs is disabled on CI servers (by intend) because it is running as a job it is often a possible source of flappy tests because it could trigger rebuilds or other effects. Also for local tests I think it should not rely on this feature and I'll check how this can be done, in general it is of course a bit uncomfortable but I hope not every jdt-dev will need to run this test regularly so in case there is an issue one would need some more setup maybe. In general I have opened this ticket here so we have better visibility of installed JDKs on the Jenkins: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/issues/6508 |
|
As a first step I have now added proper assertions to the test. In general I would not be happy to rely on simply enable auto-detect of JVMs for different reasons:
If everyone agree, I would therefore like to enhance the |
|
I now moved the search for JVMs from the JRE preference page to the So if I anticipated everything correctly this should now work on the Jenkins (but requires adjustments on mac but this can only be seen in ibuids). |
|
Jenkins is green now! |
|
Close, but no cigar. Running tests locally, I set
would be nice if the assertion also mentions the expected value Java=17 What happened? During When launching a VM for Ergo: the idea of using ranges for searching necessary VMs, nice as it sounds, is not appropriate. We do need exact matches, when launches use execution environments. |
|
I slightly tweaked the test and can reproduce the issue now, will take a look into it. In the end one could of course require a strict JVM but this seems to limited given that the given range is all valid for the MR use-case... so I think that needs to be fixed or at least better understood. |
|
I have now created and added a commit here to fix the selection of JVM, if that works I would extract this into an own PR as it does not really belongs to this change. |
So, #760 should be fixed first, to ensure that tests introduced here work reliably, right? |
Yes I'll slit up a dedicated PR fro this now. But its not only for the test but in general one would expect the best matching VM to be selected for a EE. |
I was only discussing in which order PRs should be merged. |
PR is here: if that is merged, I would rebase /squash this PR and then it should be ready for merging as well or at least for a next round of review. |
6cb5eb3 to
fb87b7f
Compare
|
@stephan-herrmann as the other PR is merged now and new stream started I rebased the PR, from my side it would be ready to be merged to be included in M1! |
|
This pull request changes some projects for the first time in this development cycle. An additional commit containing all the necessary changes was pushed to the top of this PR's branch. To obtain these changes (for example if you want to push more changes) either fetch from your fork or apply the git patch. Git patchFurther information are available in Common Build Issues - Missing version increments. |
Currently when one launches a multi-release compiled project one always gets the type from the default project folder. This now first checks what JRE is used to launch, then adds all valid folders in reverse version order to the classpath to emulate the behavior of loading a multi-release jar at runtime. Fix https://github.com/eclipse-jdt/eclipse.jdt.core/issues/4276
3890744 to
d2a61f3
Compare
|
Rebased and conflicst resolved |
|
@stephan-herrmann anything needed here to make this merged? |
stephan-herrmann
left a comment
There was a problem hiding this comment.
I dropped some more observations into eclipse-jdt/eclipse.jdt.core#4275 (comment) which signal that we are not "done".
Still the current PR is a good step forward.
|
Caused regression in SDK tests: #786 |
Just wondering could it be a regression if the test never was there before? ;-) |
|
Rgression in the sense that the tests are failing now and they were not failing before (independently because they were created, added, removed, modified or whatesever). |

Currently when one launches a multi-release compiled project one always gets the type from the default project folder.
This now first checks what JRE is used to launch, then adds all valid folders in reverse version order to the classpath to emulate the behavior of loading a multi-release jar at runtime.
Fix #755
@stephan-herrmann can you review? This is basically applying what we did for the compile case but at runtime.